package org.belkodevelop.realty.factory;

import org.belkodevelop.realty.domen.*;

public class RealtyFactory {
    
    private RealtyFactory() {
    }
    
    static public Realty getRealty(String type) {
        RealtyEnum realtyEnum = RealtyEnum.valueOf(type);
        switch (realtyEnum) {
            case APARTMENT: {
                return new Apartment();
            }
            case GARAGE: {
                return new Garage();
            }
            case HOUSE: {
                return new House();
            }
            case LAND: {
                return new Land();
            }
            case OFFICE: {
                return new Office();
            }
            default: {
                throw new RuntimeException("The wrong type of real estate!");
            }
        }
    }
}
